
    <div style="text-align:left;"class=" Category CategoriesLink">
        <h3 style="font-size:30px;">Categories</h3>
            <?php foreach ($categories as $category):?>
                <p><?php echo $this->Html->link($category['Category']['name'], array('controller'=>'categories','action'=>'view',$category['Category']['id']));?></p>
            <?php endforeach;?>
    </div>



<div id="pinkHeader" class="admin_right items index">
    <?php if ($current_customer['group_id'] == '2'): ?>
        <div id="breadcrumbAdmin" class = "breadcrumb">
               <?php $this->Html->addCrumb('Online store', '/Pages/onlinestore', array('style'=> ('text-decoration:underline; color:#EB1E70;'))); ?>
               <?php echo $this->Html->getCrumbs(' > ', array( 'text' => 'Home', 'url' => array('controller' => 'Pages', 'action' => 'pagehome'), 'escape' => false)); ?>
        </div>
     <?php endif; ?>


	<h2><?php echo __('Treasures'); ?></h2>



	    <?php if ($current_customer['group_id'] != 1): ?>

        <!-- Start merging -->
        <?php echo $this->Paginator->sort('id', '<img src="/CakePHP/img/sortid.png" title="Sort by ID" alt= "Sort by ID" />', array('escape' => false)); ?> &nbsp;
        <?php echo $this->Paginator->sort('itemname', '<img src="/CakePHP/img/sortname.png" title="Sort by name" alt= "Sort by name" />', array('escape' => false)); ?>
        <?php echo $this->Paginator->sort('photo', '<img src="/CakePHP/img/sortphoto.png" title="Sort by photo" alt= "Sort by photo" />', array('escape' => false)); ?>

                <div class="actions ">
                    <div id="search" style="text-align: left;">
                                        <?php
                                            echo $this->Form->create('Item',array('action' => 'search'));
                                            echo $this->Form->input('keywords', array('label' => 'Search for'));
                                            echo $this->Form->end();
                                        ?>
                    </div>

                    <?php if ($current_customer['group_id'] == '1'): ?>
                        <p style="list-style-type:none; margin-top:2%; margin-bottom:2%;"><?php echo $this->Html->link(__('Add New Item'), array('action' => 'add')); ?></p>
                    <?php endif; ?>
                </div>


	<table cellpadding="5" cellspacing="0" class="table ">
        <tr>
                        <?php
                                $inRow = 0;
                                foreach ($items as $item) {
                                        echo ("<td>");
                                        //echo ("<img src =".$this->Image->resize('/img/'.IMG_DIR, $item['Item']['photo'], 200, 200, true)." title=".$item['Item']['photo'].">");
                                        //echo $this->Html->image($item['Item']['photo']);
                                        echo $this->Html->image(IMG_DIR.'/'.$item['Item']['photo'], array('title' => $item['Item']['photo'], 'alt' => 'Preview image', 'height' => 200));
                                        echo ("<br>");
                                        echo ("<br>");
                                        echo $this->html->link($item['Item']['name'], array('controller' => 'items', 'action' => 'view', $item['Item']['id']));
                                        echo __('      $');
                                        echo h($item['Item']['original_price']);
                                        //echo $this->Form->create(NULL, array('url' => array('controller' => 'shop', 'action' => 'add')));
                                        //echo $this->Form->input('id', array('type' => 'hidden', 'value' => $item['Item']['id']));
                                        //echo $this->Form->input('quantity', array('type' => 'hidden', 'value' => 1));
                                        //echo $this->Form->button('<i class="icon-heart icon-white"></i> Add to bag', array('class' => 'btn btn-primary addtocart', 'id' => $item['Item']['id'], 'escape' => false));
                                        //echo $this->Form->end();
                                        echo ("<br>");
                                        echo ("<br>");
                                        echo ("<br>");
                                        echo ("</td>");
                                        $inRow++;
                                        if ($inRow % 3 == 0) {
                                                echo ("</tr>");
                                        }
                                }
                        ?>
	</table>
	
        <!-- End of merge -->

<?php endif; ?>














<?php if ($current_customer['group_id'] == 1): ?>
    <div class="actions ">
        <div id="search" style="text-align: left;">
                            <?php
                                echo $this->Form->create('Item',array('action' => 'search'));
                                echo $this->Form->input('keywords', array('label' => 'Search for'));
                                echo $this->Form->end();
                            ?>
        </div>

    		<p style="list-style-type:none; margin-top:2%; margin-bottom:2%;"><?php echo $this->Html->link(__('Add New Item'), array('action' => 'add')); ?></p>

    </div>



	<table cellpadding="5" cellspacing="0" class="table table-bordered table-hover">
        <tr>
                <th><?php echo $this->Paginator->sort('id'); ?></th>
                <th><?php echo $this->Paginator->sort('name'); ?></th>
                <th><?php echo $this->Paginator->sort('brand_id'); ?></th>

                <th><?php echo $this->Paginator->sort('category_id'); ?></th>

                <th><?php echo $this->Paginator->sort('location'); ?></th>
                <th><?php echo $this->Paginator->sort('original_price'); ?></th>

                <th class="actions"><?php echo __('Manage more'); ?></th>
        </tr>
        <?php foreach ($items as $item): ?>
            <tr id = "item_<?php echo $item['Item']['id'];?>" class="item">
                <td><?php echo h($item['Item']['id']); ?>&nbsp</td>
                <td><?php echo $this->html->link($item['Item']['name'], array('controller' => 'items', 'action' => 'view', $item['Item']['id'])); ?></td>
                <td><?php echo h($item['Brand']['name']); ?>&nbsp</td>
                <td><?php echo h($item['Category']['name']); ?>&nbsp</td>
                <td><?php echo h($item['Item']['location']); ?>&nbsp;</td>
                <td><?php echo h($item['Item']['original_price']); ?>&nbsp;</td>



                        <!--<td><?php echo $this->Html->image('item_images/'.$item['Item']['id'].'/'.$images['Image']['name'], array('width' => 175, 'height' => 175)); ?></td>-->


                <td style="width:25%;" class="actions">
                    <?php echo $this->Html->link(__('View'), array('action' => 'view', $item['Item']['id'])); ?>
                    <?php echo $this->Html->link(__('Edit'), array('action' => 'edit', $item['Item']['id'])); ?>
                    <?php echo $this->Form->postLink(__('Delete'), array('action' => 'delete', $item['Item']['id']), null, __('Are you sure you want to delete # %s?', $item['Item']['id'])); ?>
                </td>

            </tr>
        <?php endforeach; ?>
	</table>
<?php endif;?>



	<p>
        <?php
        echo $this->Paginator->counter(array(
        'format' => __('Page {:page} of {:pages}, showing {:current} records out of {:count} total, starting on record {:start}, ending on {:end}')
        ));
        ?>
    </p>

	<div class="paging">
	<?php
		echo $this->Paginator->prev('< ' . __('previous'), array(), null, array('class' => 'prev disabled'));
		echo $this->Paginator->numbers(array('separator' => ''));
		echo $this->Paginator->next(__('next') . ' >', array(), null, array('class' => 'next disabled'));
	?>
	</div>

</div>


<script type="text/javascript">
//<![CDATA[
     var items = <?php echo json_encode($items);?>;
     $('#ItemKeywords').keyup(function(e) {
         if (this.value != '') {
             for (k in items) {
                 if (items[k]['Item'].id == this.value||
                         items[k]['Item'].name.toLowerCase() == this.value.toLowerCase() ||
                         items[k]['Brand'].name.toLowerCase() == this.value.toLowerCase() ||
                         items[k]['Category'].name.toLowerCase() == this.value.toLowerCase() ||
                         items[k]['Item'].id.indexOf(this.value) >= 0 ||
                         items[k]['Item'].name.toLowerCase().indexOf(this.value.toLowerCase()) >= 0 ||
                         items[k]['Brand'].name.toLowerCase().indexOf(this.value.toLowerCase()) >= 0 ||
                         items[k]['Category'].name.toLowerCase().indexOf(this.value.toLowerCase()) >= 0
                          ) {
                     $('#item_'+items[k]['Item'].id).show();
                 }
                 else {
                     $('#item_'+items[k]['Item'].id).hide();
                 }
             }
         }
         else {
             $('.item').show();
         }
     });
//]]>
</script>